package com.rdd.transformation

import org.apache.spark.{SparkConf, SparkContext}

object testSample {

  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setAppName("testSample").setMaster("local")
    val sc = new SparkContext(conf)

    val txt = sc.textFile("src\\main\\scala\\testTxt.txt")
    val value = txt.flatMap(_.split(" "))

    /**
     * sample
     */
    value.sample(false, 0.5).foreach(println)

//    value.foreach(println)

    sc.stop()
  }

}
